﻿Public Class Utilities
    Public Shared Function GetRectangle(ByVal p1 As Point, ByVal p2 As Point) As Rectangle
        Dim result As New Rectangle
        Dim CurrentPoint As New Point

        If p1.X < p2.X Then
            CurrentPoint.X = p1.X
            result.Width = p2.X - p1.X
        Else
            CurrentPoint.X = p2.X
            result.Width = p1.X - p2.X
        End If

        If p1.Y < p2.Y Then
            CurrentPoint.Y = p1.Y
            result.Height = p2.Y - p1.Y
        Else
            CurrentPoint.Y = p2.Y
            result.Height = p1.Y - p2.Y
        End If

        result.Location = CurrentPoint
        Return result
    End Function
End Class
